<template>
  <div class="top">
    <img src="../views/images/top-logo.png" alt="">
    <div class="fr">
      <div class="fl top-state">
      </div>
      <div class="fl top-role">
        <div class="role-img fl">
          <img src="../views/images/top-img.png" alt="">
        </div>
        <div class="role-role fl">
          <el-dropdown trigger="click" @command="handleCommand">
            <span class="el-dropdown-link">
              管理员
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item class="clearfix" command='4'>
                退出登录
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    handleCommand(command) {
      if (command == 4) {
        this.$store.commit("setAccesstoken", "");
        localStorage.setItem("token", "");
        this.$router.push("/");
      }
    }
  }
};
</script>

<style lang="less">
@import "../views/css/var.less";
.top {
  height: 60px;
  width: 100%;
  background: linear-gradient(to right, #009ea3, #11bcc2);
  line-height: 60px;
  padding-left: 16px;
  padding-right: 22px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  .el-input__inner {
    height: 36px;
    width: 130px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    &:focus {
      border: none;
    }
  }
  .input-search {
    padding-right: 20px;
    height: 60px;
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    input:focus {
      width: 200px;
    }
  }
  .top-state {
    padding-right: 40px;
    .top-states {
      position: relative;
      width: 70px;
      text-align: center;
      cursor: pointer;
      &::before,
      &::after {
        position: absolute;
        top: 50%;
        left: 50%;
        margin: -20px 0 0 -20px;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        content: "";
        opacity: 0;
        pointer-events: none;
      }
    }
  }
  .top-role {
    .role-img {
      width: 44px;
      height: 44px;
      border-radius: 100%;
      background: #fff;
      margin: 8px 24px 0;
      overflow: hidden;
      line-height: 44px;
      text-align: center;
    }
    .role-role {
      color: #ffffff;
      font-size: 14px;
      cursor: pointer;
    }
  }
}
</style>

